package com.unicom.xiyan.controller;

import com.unicom.xiyan.utils.EsUtil;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * @author liry
 * @version 1.0
 * @date Created on 2021/3/24 17:03
 * Description:
 */

@RestController
@RequestMapping("/es")
public class EsController {

    @Resource
    private EsUtil esUtil;


    @RequestMapping("/get")
    public String getData() {
        try {
            esUtil.getData();
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "error";
    }


    @RequestMapping("/range")
    public String rangeData() {
        try {
            esUtil.rangeData();
            return "success";
        } catch (Exception e) {
            e.printStackTrace();
        }
        return "error";
    }
}
